xen/string: Use compiler __builtin_*() where possible
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 2 Aug 2016 19:55:12 +0000 (19:55 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 31 May 2017 13:05:21 +0000 (14:05 +0100)
commitb9088aa7e8959566b9c27fb9e225b3a7efa882eb
treeaa2d79e503f9ee215ec943b269f7647159634082
parentb02728b3b689e145a52c46cd9eae5be48e905df7
xen/string: Use compiler __builtin_*() where possible

The use of -fno-builtin inhibits these automatic transformations.  This causes
constructs such as strlen("literal") to be evaluated at compile time, and
certain simple operations to be replaced with repeated string operations.

To avoid the macro altering the function names, use the method recommended by
the C specification by enclosing the function name in brackets to avoid the
macro being expanded.  This means that optimisation opportunities continue to
work in the rest of the translation unit.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/string.c
xen/include/xen/string.h